package com.hongdee.insurance.company.service;

import com.hongdee.base.imp.vo.ExcelSchemeVo;
import com.hongdee.insurance.company.entity.TInsuranceCompanyBill;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

/**
 * @author 王帅
 * @className TInsuranceCompanyBillService
 * @type
 * @description 保险公司 对账单Service
 * @path com.hongdee.insurance.company.service
 * @create 2017/6/14 9:06
 **/
public interface ITInsuranceCompanyBillService {

    /**
     * 新增保险公司对账信息
     * @param data
     * @param uid
     * @return
     */
    public TInsuranceCompanyBill save(TInsuranceCompanyBill data,String uid) throws Exception;

    /**
     * 分页查询对账单信息
     * @param data
     * @param uid
     * @param start
     * @param limit
     * @return
     * @throws Exception
     */
    public Map page(Map data, String uid, String start, String limit) throws Exception;

    /**
     * 清空对账单明细
     * @param billId
     * @throws Exception
     */
    public void moveBillDetail(String billId)throws Exception;

    /**
     * 删除对账单
     * @param billid
     * @throws Exception
     */
    public void delBill(String billid)throws Exception;

    /**
     * 保险公司导入模板
     * @return
     * @throws Exception
     */
    public List<Map<String, Object>> findExcelScheme() throws Exception;

    /**
     *
     * @param schemeId
     * @return
     * @throws Exception
     */
    public ExcelSchemeVo loadExcelSchemeInfo(String schemeId) throws Exception;

    /**
     * 导入对账单明细由保险公司给予
     * @param file
     * @param scheme
     * @param uid
     * @param billId
     * @return
     * @throws Exception
     */
    public int[] parseExcel(MultipartFile file, ExcelSchemeVo scheme, String uid,String billId) throws Exception;

    /**
     * 导入结平对账单明细信息 由保险公司给予用于补回上个对账单差额
     * @param file
     * @param scheme
     * @param uid
     * @param billId
     * @return
     * @throws Exception
     */
    public int[] parseExcelByBalance(MultipartFile file, ExcelSchemeVo scheme, String uid,String billId,String type) throws Exception;

    /**
     * 根据对账单信息 查询上传的明细信息
     * @param billId
     * @return
     * @throws Exception
     */
    public Map getBillDetailList(String billId,String start,String limit,Map<String,Object> data) throws Exception;
    public XSSFWorkbook billDetailExpExcel(String uid,String billId,Map data) throws Exception;
    /**
     * 结算对账单
     * @param data
     * @param uid
     * @throws Exception
     */
    public void balanceOrder(Map<String,Object> data,String uid,String billId) throws Exception;

    /**
     * 对账单明细查询
     * @param uid
     * @param billId
     * @param data
     * @return
     * @throws Exception
     */
    public Map billDetailPage(String uid,String billId,Map data,String start,String limit)throws Exception;

    /**
     * 移除对账单中的保单信息
     * @param uid
     * @param data
     * @throws Exception
     */
    public void removeDetailById(String uid,List<Map> data) throws Exception;

    /**
     * 获得对账单详情
     * @param id
     * @return
     * @throws Exception
     */
    public TInsuranceCompanyBill getBillInfo(String id)throws Exception;

    /**
     * 差异明细查询
     * @param uid
     * @param billId
     * @param start
     * @param limit
     * @param data
     * @return
     * @throws Exception
     */
    public Map diffDetailPage(String uid,String billId,String start,String limit,Map data) throws Exception;

    /**
     * 差异明细 自动结算
     * @param uid
     * @param billId
     * @param data
     * @throws Exception
     */
    public void diffBalanceDetail(String uid,String billId,Map data) throws Exception;

    /**
     * 差异明细 自动结算 批量结算
     * @param uid
     * @param billId
     * @param data
     * @throws Exception
     */
    public void diffBalanceDetails(String uid,String billId,Map data) throws Exception;

    /**
     * 差异明细 更新调整因素并结算
     * @param uid
     * @param billId
     * @param detailId
     * @param data
     * @param blanceId
     * @throws Exception
     */
    public void diffBalanceDetailAndUpd(String uid,String billId,String detailId,Map data,String blanceId)throws Exception;

    /**
     * 差异明细 更新调整因素并结算
     * @param uid
     * @param billId
     * @param data
     * @throws Exception
     */
    public void diffBalanceDetailAdjust(String uid, String billId,Map data) throws Exception;
    /**
     * 导出差异明细Excel
     * @param uid
     * @param billId
     * @param data
     * @return
     * @throws Exception
     */
    public XSSFWorkbook diffExpExcel(String uid, String billId, Map data) throws Exception;

    /**
     * 录入对账单开票信息
     * @param billid
     * @param billingDate
     * @param billingPrice
     * @param invoiceNumber
     * @throws Exception
     */
    public void billing(String billid,String billingDate,String billingPrice,String invoiceNumber) throws Exception;


    /**
     * 1、添加保单至结算单
     * 2、结算保险单
     * @param uid
     * @param billId
     * @param data
     * @throws Exception
     */
    public void addInsuranctOrderToBalance(String uid,String billId,List<Map> data) throws Exception;

    /**
     * 根据一个总金额去调整对账单中待平账的对账单
     * @param bill
     * @param price
     * @return
     * @throws Exception
     */
    public Float diffBalanceBillByPrice(TInsuranceCompanyBill bill,Float price) throws Exception;

    /**
     * 根据发票批量结账
     * @param data
     * @param invoiceNum
     * @param invoiceDate
     * @param invoicePrice
     * @param uid
     * @param adjustType
     * @throws Exception
     */
    public void diffBalanceBillByDateList(List<Map> data,String invoiceNum,String invoiceDate,String invoicePrice,String uid,String adjustType) throws Exception;

    /**
     * 调整日志信息
     * @param billId
     * @return
     */
    public Map findBalanceAdjustLogs(String billId,String start,String limit)throws Exception;

    /**
     * 调整保险公司保费及佣金，使其与4s店填写一致，便于后期对账
     * @param billid
     * @param data
     * @throws Exception
     */
    public void diffBalanceInsuranceCom(String billid,String uid,Map<String,Object> data) throws Exception;

    /**
     * 调整因素日志
     * @param billId
     * @return
     * @throws Exception
     */
    public List<Map<String, Object>> diffBalanceInsuranceComLogs(String billId) throws Exception;

    /**
     * 获取对账单针对的公司信息
     * @param billId
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> diffBalanceCompanys(String billId) throws Exception;
}
